package io.renren.common.utils;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.net.URL;

/**
 * @Description
 * @Author haijun.zhang@luckincoffee.com
 * @Date 2018-08-07 12:32
 **/
public class FileUtils extends org.apache.commons.io.FileUtils {
    
    /**
     * 日志
     */
    private static final Logger LOGGER = LoggerFactory.getLogger(FileUtils.class);

    public static String getJsonStr(String filename){
        String fileStr = "";

        try {
            File file = new File(FileUtils.class.getClassLoader().getResource(filename).getFile());
            fileStr = readFileToString(file,"UTF-8");
        } catch (IOException e) {
            LOGGER.error("读取资源异常：{}",e.getMessage());
        }
        return fileStr;
    }

}
